package com.tjn.string_;

/**
 * @author 陶镓妮
 * @version 1.0
 */
public class Test1 {
    String str = new String("hsp");
    final char[] ch ={'j','a','v','a'};
    public void change(String str, char ch[]){
        str = "java";
        ch[0] = 'h';
    }
    public static void main(String[] args){
    Test1 ex = new Test1();
    ex.change(ex.str, ex.ch);
    System.out.print(ex.str + " and ");
    //这个地方的ex.str指的是hsp,而非java，因为change方法用完之后就销毁了，所以ex.str指向的还是hsp
    System.out.println(ex.ch);
    }
}
//结果是hsp and hava